<template>
	<view>
		<view class="box">
			<view class="row flex">
				<view class="size-28 ml-20">昵称</view>
				<input v-model="nickname" type="text">
			</view>
			<view class="row flex">
				<view class="size-28 ml-20">所属科室</view>
				<input type="text">
			</view>
			<view class="row">
				<view class="size-28 ml-20">简介</view>
				<textarea v-model="brief" name="" id="" cols="30" rows="10" placeholder="请输入简介"></textarea>
			</view>
		</view>
		<view class="btn" @click="info">
			确认
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickname: '',
				brief:''
			}
		},
		onLoad() {
		},
		methods: {
			info() {
				if (this.nickname != '') {
					this.$api.editNick({
						nickname: this.nickname
					}).then(res => {
						if(res.code == 1){
							uni.setStorageSync('nickname',this.nickname)
						}
						this.$utils.showToast(res.msg)
					})
				}
				if(this.brief != ''){
					this.$api.editInfo({
						description: this.brief
					}).then(res => {
						if(res.code == 1){
							uni.setStorageSync('brief',this.nickname)
						}
						this.$utils.showToast(res.msg)
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
	}

	.btn {
		position: fixed;
		left: 50%;
		transform: translateX(-50%);
		bottom: 80rpx;
	}

	.box {
		width: 690rpx;
		height: 556rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		margin: 30rpx auto 0;
		padding: 0 30rpx;

		.row {
			padding: 30rpx 0;
			border-bottom: 2rpx solid #f8f8f8;

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}

		.row:last-child {
			border: none;
		}
	}

	input {
		font-size: 28rpx;
		text-align: right;
	}

	textarea {
		width: 100%;
		height: 120rpx;
		padding: 20rpx;
		font-size: 28rpx;
	}
</style>
